import { useState, useEffect } from 'react';
import { getCurrentInstance } from '@tarojs/taro';
import { View } from "@tarojs/components";
import Header from "@/components/header";
import Return from '@/components/Return';
import ArticleDetail from '@/components/ArticleDetail';
import { getArticleDetailsData } from "@/api/index";
import "taro-ui/dist/style/components/article.scss";
import css from './index.module.less';

export default function FightFortDetails() {
    const router = getCurrentInstance().router.params;
    const [articleData, setArticleData] = useState({});

    useEffect(() => {
        getArticleDetailsData(router.id, router.msgId).then((res) => {
            setArticleData(res.data);
        });
    }, []);

    return (
        <View className={css.app}>
            <Header message='战斗堡垒' left='140px' />
            <Return />
            <View className={css.content}>
                <ArticleDetail info={{ ...articleData, userId: router.id, type: router.type }} />
            </View>
        </View>
    );
}
